﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;

namespace WebMisc.CSS
{
    public enum GradientPosition
    {
        top,
        buttom,
        left,
        right
    }

    internal class Gradient
    {
        private const string CSSString = @".{0}
{
    background: {4}; /* for non-css3 browsers */ 
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='{3}', endColorstr='{4}'); /* для IE6-9 */
    background: -webkit-linear-gradient({1}, {2}, {3}, {4}); /* для webkit-браузеров */
    background: -moz-linear-gradient({1},  {3},  {4}); /* для firefox 3.6+ */ 
    background: -o-linear-gradient({1},  {3},  {4}; /* для Opera 11.10+ */
    background: -ms-linear-gradient({1},  {3},  {4}); /* для IE10+ */
    background: -webkit-gradient(linear, left {1}, left {2}, from({3}), to({4}));
}​";
        public static string GetCSS(string name, GradientPosition firstPosition, GradientPosition lastPosition, Color firstColor, Color lastColor)
        {
            return string.Format(CSSString, name, firstPosition, lastPosition, firstColor.Name, lastColor.Name);
        }
    }
}
